3.1.82 \(\int \frac {\csc (c+d x)}{a+b \sin ^2(c+d x)} \, dx\) [82]

Optimal. Leaf size=55 \[ -\frac {\tanh ^{-1}(\cos (c+d x))}{a d}+\frac {\sqrt {b} \tanh ^{-1}\left (\frac {\sqrt {b} \cos (c+d x)}{\sqrt {a+b}}\right )}{a \sqrt {a+b} d} \]

[Out]

-arctanh(cos(d*x+c))/a/d+arctanh(cos(d*x+c)*b^(1/2)/(a+b)^(1/2))*b^(1/2)/a/d/(a+b)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3265, 400, 212, 214} \begin {gather*} \frac {\sqrt {b} \tanh ^{-1}\left (\frac {\sqrt {b} \cos (c+d x)}{\sqrt {a+b}}\right )}{a d \sqrt {a+b}}-\frac {\tanh ^{-1}(\cos (c+d x))}{a d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Csc[c + d*x]/(a + b*Sin[c + d*x]^2),x]

[Out]

-(ArcTanh[Cos[c + d*x]]/(a*d)) + (Sqrt[b]*ArcTanh[(Sqrt[b]*Cos[c + d*x])/Sqrt[a + b]])/(a*Sqrt[a + b]*d)

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 400

Int[1/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[b/(b*c - a*d), Int[1/(a + b*x^n),
 x], x] - Dist[d/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0]

Rule 3265

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = Free
Factors[Cos[e + f*x], x]}, Dist[-ff/f, Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*(a + b - b*ff^2*x^2)^p, x], x, Cos
[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rubi steps

\begin {align*} \int \frac {\csc (c+d x)}{a+b \sin ^2(c+d x)} \, dx &=-\frac {\text {Subst}\left (\int \frac {1}{\left (1-x^2\right ) \left (a+b-b x^2\right )} \, dx,x,\cos (c+d x)\right )}{d}\\ &=-\frac {\text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (c+d x)\right )}{a d}+\frac {b \text {Subst}\left (\int \frac {1}{a+b-b x^2} \, dx,x,\cos (c+d x)\right )}{a d}\\ &=-\frac {\tanh ^{-1}(\cos (c+d x))}{a d}+\frac {\sqrt {b} \tanh ^{-1}\left (\frac {\sqrt {b} \cos (c+d x)}{\sqrt {a+b}}\right )}{a \sqrt {a+b} d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains complex when optimal does not.
time = 0.19, size = 143, normalized size = 2.60 \begin {gather*} -\frac {\frac {\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b}-i \sqrt {a} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a-b}}\right )}{\sqrt {-a-b}}+\frac {\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b}+i \sqrt {a} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a-b}}\right )}{\sqrt {-a-b}}+\log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{a d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Csc[c + d*x]/(a + b*Sin[c + d*x]^2),x]

[Out]

-(((Sqrt[b]*ArcTan[(Sqrt[b] - I*Sqrt[a]*Tan[(c + d*x)/2])/Sqrt[-a - b]])/Sqrt[-a - b] + (Sqrt[b]*ArcTan[(Sqrt[
b] + I*Sqrt[a]*Tan[(c + d*x)/2])/Sqrt[-a - b]])/Sqrt[-a - b] + Log[Cos[(c + d*x)/2]] - Log[Sin[(c + d*x)/2]])/
(a*d))

________________________________________________________________________________________

Maple [A]
time = 0.28, size = 62, normalized size = 1.13

method result size
derivativedivides \(\frac {\frac {b \arctanh \left (\frac {b \cos \left (d x +c \right )}{\sqrt {\left (a +b \right ) b}}\right )}{a \sqrt {\left (a +b \right ) b}}+\frac {\ln \left (\cos \left (d x +c \right )-1\right )}{2 a}-\frac {\ln \left (1+\cos \left (d x +c \right )\right )}{2 a}}{d}\) \(62\)
default \(\frac {\frac {b \arctanh \left (\frac {b \cos \left (d x +c \right )}{\sqrt {\left (a +b \right ) b}}\right )}{a \sqrt {\left (a +b \right ) b}}+\frac {\ln \left (\cos \left (d x +c \right )-1\right )}{2 a}-\frac {\ln \left (1+\cos \left (d x +c \right )\right )}{2 a}}{d}\) \(62\)
risch \(\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{a d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{a d}+\frac {i \sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i \sqrt {-\left (a +b \right ) b}\, {\mathrm e}^{i \left (d x +c \right )}}{b}+1\right )}{2 \left (a +b \right ) d a}-\frac {i \sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i \sqrt {-\left (a +b \right ) b}\, {\mathrm e}^{i \left (d x +c \right )}}{b}+1\right )}{2 \left (a +b \right ) d a}\) \(155\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(d*x+c)/(a+sin(d*x+c)^2*b),x,method=_RETURNVERBOSE)

[Out]

1/d*(1/a*b/((a+b)*b)^(1/2)*arctanh(b*cos(d*x+c)/((a+b)*b)^(1/2))+1/2/a*ln(cos(d*x+c)-1)-1/2/a*ln(1+cos(d*x+c))
)

________________________________________________________________________________________

Maxima [A]
time = 0.55, size = 83, normalized size = 1.51 \begin {gather*} -\frac {\frac {b \log \left (\frac {b \cos \left (d x + c\right ) - \sqrt {{\left (a + b\right )} b}}{b \cos \left (d x + c\right ) + \sqrt {{\left (a + b\right )} b}}\right )}{\sqrt {{\left (a + b\right )} b} a} + \frac {\log \left (\cos \left (d x + c\right ) + 1\right )}{a} - \frac {\log \left (\cos \left (d x + c\right ) - 1\right )}{a}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)/(a+b*sin(d*x+c)^2),x, algorithm="maxima")

[Out]

-1/2*(b*log((b*cos(d*x + c) - sqrt((a + b)*b))/(b*cos(d*x + c) + sqrt((a + b)*b)))/(sqrt((a + b)*b)*a) + log(c
os(d*x + c) + 1)/a - log(cos(d*x + c) - 1)/a)/d

________________________________________________________________________________________

Fricas [A]
time = 0.42, size = 161, normalized size = 2.93 \begin {gather*} \left [\frac {\sqrt {\frac {b}{a + b}} \log \left (\frac {b \cos \left (d x + c\right )^{2} + 2 \, {\left (a + b\right )} \sqrt {\frac {b}{a + b}} \cos \left (d x + c\right ) + a + b}{b \cos \left (d x + c\right )^{2} - a - b}\right ) - \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{2 \, a d}, -\frac {2 \, \sqrt {-\frac {b}{a + b}} \arctan \left (\sqrt {-\frac {b}{a + b}} \cos \left (d x + c\right )\right ) + \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{2 \, a d}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)/(a+b*sin(d*x+c)^2),x, algorithm="fricas")

[Out]

[1/2*(sqrt(b/(a + b))*log((b*cos(d*x + c)^2 + 2*(a + b)*sqrt(b/(a + b))*cos(d*x + c) + a + b)/(b*cos(d*x + c)^
2 - a - b)) - log(1/2*cos(d*x + c) + 1/2) + log(-1/2*cos(d*x + c) + 1/2))/(a*d), -1/2*(2*sqrt(-b/(a + b))*arct
an(sqrt(-b/(a + b))*cos(d*x + c)) + log(1/2*cos(d*x + c) + 1/2) - log(-1/2*cos(d*x + c) + 1/2))/(a*d)]

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\csc {\left (c + d x \right )}}{a + b \sin ^{2}{\left (c + d x \right )}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)/(a+b*sin(d*x+c)**2),x)

[Out]

Integral(csc(c + d*x)/(a + b*sin(c + d*x)**2), x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 100 vs. \(2 (47) = 94\).
time = 0.55, size = 100, normalized size = 1.82 \begin {gather*} -\frac {\frac {2 \, b \arctan \left (\frac {b \cos \left (d x + c\right ) + a + b}{\sqrt {-a b - b^{2}} \cos \left (d x + c\right ) + \sqrt {-a b - b^{2}}}\right )}{\sqrt {-a b - b^{2}} a} - \frac {\log \left (\frac {{\left | -\cos \left (d x + c\right ) + 1 \right |}}{{\left | \cos \left (d x + c\right ) + 1 \right |}}\right )}{a}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)/(a+b*sin(d*x+c)^2),x, algorithm="giac")

[Out]

-1/2*(2*b*arctan((b*cos(d*x + c) + a + b)/(sqrt(-a*b - b^2)*cos(d*x + c) + sqrt(-a*b - b^2)))/(sqrt(-a*b - b^2
)*a) - log(abs(-cos(d*x + c) + 1)/abs(cos(d*x + c) + 1))/a)/d

________________________________________________________________________________________

Mupad [B]
time = 13.73, size = 457, normalized size = 8.31 \begin {gather*} -\frac {\mathrm {atanh}\left (\cos \left (c+d\,x\right )\right )}{a\,d}-\frac {\mathrm {atan}\left (\frac {\frac {\left (2\,b^3\,\cos \left (c+d\,x\right )+\frac {\left (2\,a^2\,b^2-\frac {\cos \left (c+d\,x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}\,1{}\mathrm {i}}{a^2+b\,a}+\frac {\left (2\,b^3\,\cos \left (c+d\,x\right )-\frac {\left (2\,a^2\,b^2+\frac {\cos \left (c+d\,x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}\,1{}\mathrm {i}}{a^2+b\,a}}{\frac {\left (2\,b^3\,\cos \left (c+d\,x\right )+\frac {\left (2\,a^2\,b^2-\frac {\cos \left (c+d\,x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{a^2+b\,a}-\frac {\left (2\,b^3\,\cos \left (c+d\,x\right )-\frac {\left (2\,a^2\,b^2+\frac {\cos \left (c+d\,x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{a^2+b\,a}}\right )\,\sqrt {b\,\left (a+b\right )}\,1{}\mathrm {i}}{d\,\left (a^2+b\,a\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(sin(c + d*x)*(a + b*sin(c + d*x)^2)),x)

[Out]

- atanh(cos(c + d*x))/(a*d) - (atan((((2*b^3*cos(c + d*x) + ((2*a^2*b^2 - (cos(c + d*x)*(16*a^2*b^3 + 8*a^3*b^
2)*(b*(a + b))^(1/2))/(4*(a*b + a^2)))*(b*(a + b))^(1/2))/(2*(a*b + a^2)))*(b*(a + b))^(1/2)*1i)/(a*b + a^2) +
 ((2*b^3*cos(c + d*x) - ((2*a^2*b^2 + (cos(c + d*x)*(16*a^2*b^3 + 8*a^3*b^2)*(b*(a + b))^(1/2))/(4*(a*b + a^2)
))*(b*(a + b))^(1/2))/(2*(a*b + a^2)))*(b*(a + b))^(1/2)*1i)/(a*b + a^2))/(((2*b^3*cos(c + d*x) + ((2*a^2*b^2
- (cos(c + d*x)*(16*a^2*b^3 + 8*a^3*b^2)*(b*(a + b))^(1/2))/(4*(a*b + a^2)))*(b*(a + b))^(1/2))/(2*(a*b + a^2)
))*(b*(a + b))^(1/2))/(a*b + a^2) - ((2*b^3*cos(c + d*x) - ((2*a^2*b^2 + (cos(c + d*x)*(16*a^2*b^3 + 8*a^3*b^2
)*(b*(a + b))^(1/2))/(4*(a*b + a^2)))*(b*(a + b))^(1/2))/(2*(a*b + a^2)))*(b*(a + b))^(1/2))/(a*b + a^2)))*(b*
(a + b))^(1/2)*1i)/(d*(a*b + a^2))

________________________________________________________________________________________